<template>
  <section class="more-section">
    <div class="more-title">
      <h2>MORE</h2>
      <div class="divider"></div>
    </div>
    
    <div class="services-container">
      <div class="services-row">
        <div v-for="(service, index) in services" :key="index" class="service-item">
          <div class="service-icon">
            <img v-if="service.icon" :src="service.icon" :alt="service.text" class="icon-image">
          </div>
          <div class="service-text">{{ service.text }}</div>
        </div>
      </div>
    </div>
  </section>
</template>

<script lang="ts" setup>
import { ref, onMounted } from 'vue';
import SVG_ICONS from '@/assets/SVG_ICONS';

// 服务项目接口
interface ServiceItem {
  icon: string | null;
  text: string;
  url?: string; // 添加可选的url字段
}

// 设置基本服务数据结构
const services = ref<ServiceItem[]>([
  {
    icon: null, //15天内轻松退货
    text: 'Subscribe For Up To 30% Off',
    url: '/user/points'
  },
  {
    icon: null, // 15天内轻松退货
    text: 'Easy Returns Within 15 Days',
    url: '/help/delivery/delivery-key-information'
  },
  {
    icon: null, // 快递服务
    text: 'Express Shipping Service',
    url: '/help/returns/how-to-return?key=how_do_I_return'
  },
  {
    icon: null, // 付款保证
    text: 'Payment Guarantee',
    url: '/privacy-policy'
  }
]);

// 在组件挂载后设置图标
onMounted(() => {
  // 使用相对路径
  services.value[1].icon = SVG_ICONS.return_icon;
  services.value[2].icon = SVG_ICONS.shipping_icon;
  services.value[3].icon = SVG_ICONS.payment_icon;
});
</script>

<style scoped lang="scss">
.more-section {
  // padding: 30px 0;
  // border-top: 1px solid #f0f0f0;
  // border-bottom: 1px solid #f0f0f0;
  
  color: #000;
  margin: 60px 0 0;
}

.more-title {
  text-align: center;
  margin-bottom: 30px;
  h2 {
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 1px;
    color: #000;
    margin-bottom: 2px;
  }
  
  .divider {
    width: 50px;
    height: 4px;
    background-color: #000;
    margin: 0 auto;
  }
}

.services-container {
  background-color: #b8857b;
  // max-width: 1200px;
  margin: 0 auto;
  padding: 30px 0;
  color: #fff;
}

.services-row {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 0 15px;
}

.service-item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  text-align: center;
  position: relative;
  
  &:not(:last-child):after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    height: 30px;
    width: 1px;
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%);
  }
}

.service-icon {
  margin-right: 10px;
  display: flex;
  align-items: center;
  
  .icon-image {
    width: 24px;
    height: 24px;
    filter: brightness(0) invert(1); // 使图标变成白色
  }
}

.service-text {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  letter-spacing: 0.5px;
  cursor: pointer;
  --font-size-text-style: 16px;
    --font-size-text-style-mb: 16px;
    --font-weight-text-style: 500;
    --font-style-text-style: normal;
    --mg-bottom-text-style: 0px;
    &:hover{
      text-decoration: underline;
    }
}

// 响应式样式
@media (max-width: 992px) {
  .service-item {
    padding: 0 10px;
  }
  
  .service-text {
    font-size: 13px;
  }
}

@media (max-width: 768px) {
  .services-row {
    flex-wrap: wrap;
  }
  
  .service-item {
    flex: 1 0 50%;
    padding: 15px 10px;
    
    &:not(:last-child):after {
      display: none;
    }
    
    &:nth-child(odd):after {
      content: '';
      position: absolute;
      right: 0;
      top: 50%;
      height: 30px;
      width: 1px;
      background-color: rgba(255, 255, 255, 0.3);
      transform: translateY(-50%);
      display: block;
    }
    
    &:nth-child(-n+2):before {
      content: '';
      position: absolute;
      bottom: 0;
      left: 15%;
      width: 70%;
      height: 1px;
      background-color: rgba(255, 255, 255, 0.3);
    }
  }
}

@media (max-width: 576px) {
  .more-section {
    padding: 20px 0;
  }
  
  .service-item {
    flex: 1 0 100%;
    
    &:not(:last-child) {
      margin-bottom: 10px;
      padding-bottom: 10px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    }
    
    &:nth-child(odd):after,
    &:nth-child(-n+2):before {
      display: none;
    }
  }
  
  .more-title h2 {
    font-size: 20px;
  }
  
  .service-text {
    font-size: 12px;
  }
}
</style> 